<!DOCTYPE html>
<html lang="utf-8">
<head>
    <meta charset="UTF-8">
    <#include "/comm/module-index.ftl"/>
</head>
<#include "/comm/js_user_all.ftl">
<body>
<div class="layui-div-body">
    <div class="layui-fluid  layui-div-table">
        <div>
            <form class="layui-form searchForm" autocomplete="off" id="searchForm" lay-filter="searchForm">
                <div class="layui-inline layui-show-xs-block layui-input-wrap">
                    <div class="layui-input-prefix">
                        <i class="layui-icon layui-icon-date"></i>
                    </div>
                    <input class="layui-input table-search-date" autocomplete="off" placeholder="开始日"
                           name="startDate" id="start">
                </div>
                <div class="layui-inline layui-show-xs-block  layui-input-wrap">
                    <div class="layui-input-prefix">
                        <i class="layui-icon layui-icon-date"></i>
                    </div>
                    <input class="layui-input table-search-date" autocomplete="off" placeholder="截止日" name="endDate"
                           id="end">
                </div>
                <div class="layui-inline layui-show-xs-block">
                    <input type="text" name="keyword" placeholder="关键字" autocomplete="off"
                           class="layui-input">
                </div>
                <div class="layui-inline layui-show-xs-block">
                    <button class="layui-btn  layui-btn-sm" lay-submit="" lay-filter="table-search"><i
                                class="layui-icon"></i>查询
                    </button>
                    <button class="layui-btn  layui-btn-sm layui-btn-primary" type="reset" id="btn-search-reset"><i
                                class="layui-icon"></i>重置
                    </button>

                </div>
            </form>
            <div class="common-btn-block">
                <@shiro code="gen:article:advertising:add">
                    <a class="layui-btn layui-btn-sm" lay-on="add"><i
                                class="layui-icon  layui-icon-add-1"></i> 添加
                    </a>
                </@shiro>
                <@shiro code="gen:article:category:delete">
                    <a type="button" class="layui-btn layui-btn-sm layui-btn-danger" lay-on="deletes">
                        <i class="layui-icon layui-icon-delete"></i> 删除
                    </a>
                </@shiro>
            </div>
        </div>
        <#-- table-->
        <div class="layui-table-body" style="flex: 1" id="layui-table-bar">
            <table class="layui-hide" lay-filter="layui-table-main" id="layui-table-main"></table>
        </div>
    </div>
</div>
<script type="text/html" id="myOperateBtn">
    {{#  if(d._status >-2){ }}
    <@shiro code="gen:article:advertising:edit">
        <a class="layui-btn layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>编辑</a>
    </@shiro>
    <@shiro code="gen:article:advertising:delete">
        <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a>
    </@shiro>
    {{#  } }}
</script>
<script type="text/html" id="myStatusBtn">
    {{#  if(d._status==1){ }}
    <a class="layui-btn layui-btn-primary layui-border-green layui-btn-xs" <@shiro code="gen:article:advertising:status"> lay-event="disable"</@shiro>>
        启用
    </a>
    {{#  } else if(d._status==-1){ }}
    <a class="layui-btn layui-btn-primary layui-btn-xs" <@shiro code="gen:article:advertising:status"> lay-event="disable"</@shiro>>
        禁用
    </a>
    {{#  } else { }}
    <a class="layui-btn  layui-bg-orange layui-btn-xs ">{{ statusStr(d._status) }}</a>
    {{#  } }}
</script>
<script type="text/javascript">
    layui.use(['index'], function () {
        let tableBase = layui.index;
        tableBase.render({
            cols: [{
                type: 'checkbox',
                fixed: 'left',
                align: 'center'
            },    {type: 'space', hide: true, field: "_id"},
                {type: 'numbers', title: "序号", fixed: 'left'},
                {field: 'img', title: '图片地址'},
                // {field: 'url', title: '链接'},
                // {field: 'startTime', title: '开始时间'},
                // {field: 'endTime', title: '结束时间'},
                // {field: 'type', title: '类型'},
                {field: 'seq', title: '排序'},
                {field: 'description', title: '备注'},

                {
                    field: 'creator', title: '创建者', templet: function (obj) {
                        return systemUserFormatter(obj.creator);
                    }
                },
                {title: '状态', width: 60, field: '_status', toolbar: '#myStatusBtn', align: 'center'},
                {fixed: 'right', title: '操作', toolbar: '#myOperateBtn', width: 130, align: 'center'}

            ],
            area: ['800px', '500px']
        })

    });

</script>
</body>
</html>
</html>
